import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.ScrollPane;
import java.awt.Scrollbar;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;


public class Jnippet extends JFrame implements ActionListener {

	
	/* Data Zona */
	private static final long serialVersionUID = 8441996830641336371L;
	
	JPanel north, center, south, east, west;
	JTree tree;
	JEditorPane jep;
	JScrollPane scrolljep, scrolltree;
	
	boolean [] look = {false,true}; // [0] - System Look and Feel [1] - Cross Platform Look and Feel
	
	/* Constructor */
	public Jnippet(){
		
		super("Jnippet");
		
		/* Look and Feel */
		if (look[0]) {
				try {
					UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
					System.out.print("aqui");
				} catch (Exception e) {
					System.err.println(e);
				};
				}
		if (look[1]) {
			try {
				UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
				System.out.print("ali");
			} catch (Exception e) {
				System.err.println(e);
			};
		}
			/* Look and Feel - END */
		
		/* West Panel */
		west = new JPanel(new GridLayout(1,1));
		tree = new JTree();
		
		tree.setBorder(new TitledBorder("Tree"));
		west.add(tree);
		/* West Panel - END */
		
		/* Center Panel */
		center = new JPanel(new GridLayout(1,1));
		jep = new JEditorPane();
		jep.setBorder(new TitledBorder("Editor"));
		scrolljep = new JScrollPane(jep);
		center.add(scrolljep);
		/* Center Panel - END */
		
		getContentPane().add(center, BorderLayout.CENTER);
		getContentPane().add(west, BorderLayout.WEST);		
		
		setSize(960,600);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setLocationRelativeTo(null);
		//setVisible(true);
	}
	

	/* Methods */
	public void actionPerformed(ActionEvent arg0) {
		
	}
	
	public boolean [] changeLookandFell(boolean [] look){
		look[0] = changeBooleanState(look[0]);
		look[1] = changeBooleanState(look[1]);
		return look;
	}
	
	public boolean changeBooleanState(boolean b){
		if(b=true)
			b=false;
		else if(b=false)
			b=true;
		return b;
	}
	
	/* main */
	public static void main(String [] args){
		//new Jnippet();
	       
	        SwingUtilities.invokeLater(new Runnable() {
	            
	            public void run() {
	                new Jnippet().setVisible(true);
	            }
	        });
		
	}

}//class - END
